import webspider.mysql.mysql as mysql
from webspider.settings import MYSQL_TB

def create_table():
    sql = """
            CREATE TABLE {}(
             id int primary key auto_increment,
             companyFullName CHAR(72) not null,
             area CHAR (72),
             location CHAR(72),
             positionName CHAR(72) NOT NULL,
             Key_word CHAR(72) not null ,
             time CHAR(32),
             salary CHAR(32) NOT NULL,
             salary_min FLOAT ,
             salary_max FLOAT,
             url CHAR(104))
            """.format(MYSQL_TB)

    with mysql.DB(host='localhost', user='root', passwd='123456', db='51job') as db:
        db.execute(sql)


create_table()
